 
<html>
  <head>
    <title>TODO supply a title</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <script src="jquery-3.6.0.min.js"></script>
     <style>
       ul.pagination {display: inline-block;padding: 0;margin: 0;}
ul.pagination li {display: inline;}
ul.pagination li a {color: black;float: left;padding: 8px 16px;text-decoration: none;}
div.center {text-align: center;}
.content-text:target~#hqyc {display: none}
.content-text:target {display: block;}
.content-text{display: none;}
</style>
 
    <script>
$(document).ready(function () {
  $("#button").click(function () {
        $.ajax({
          "url": "6-1.php",
          "method": "post",
          "dataType": "text",
          "data": {data: $("#text").val()
          }, "success": function (response) {
            //成功請求資源時
           $("label").html(response);
          }, "error": function (error) {
            //當錯誤發生時
          }
        });
      });
});
      
    </script>
  </head>
  <body>
    <input type="text"  id="text" />
    <input type="button" id="button" value="提交" />
    <label></label>
     <div class="center">
<ul class="pagination">
<li><a href="#">1</a></li>
<li><a href="#content-2">2</a></li>
<li><a href="#content-3">3</a></li>
</ul>
</div>
<div id="content-2" class="content-text">我是内容2</div>
<div id="content-3" class="content-text">我是内容3</div>
<div id="hqyc">这是个首页</div>

  </body>
</html>
